package com.tree.experiment.quietcam;

import java.util.HashMap;

import android.hardware.Camera;

public class CameraParametersUtility {
	
	public static HashMap<String, String> parametersMap = new HashMap<String, String>();
	
	public static HashMap<String, String> storeCameraParametersToHashMap(Camera.Parameters params)
	{
		String paramsFlattenString = params.flatten();
		String[] paramsPairArray = paramsFlattenString.split(";");
		for (String paramsPair : paramsPairArray)
		{
			String[] paramKeyAndValue = paramsPair.split("=");
			System.out.println(paramsPair);
			parametersMap.put(paramKeyAndValue[0], paramKeyAndValue.length == 1 ? "" : paramKeyAndValue[1]);
		}
		return parametersMap;
	}

	public static Camera.Parameters prepareCameraParameters(Camera.Parameters parm)
	{
		parm.set("sharpness-max","30");
		parm.set("zoom","0");
		parm.set("redeye-reduction-values","enable,disable");
		parm.set("max-num-detected-faces-hw","10");
		parm.set("scene-detect-values","off,on");
		parm.set("capture-mode-values","normal,contiburst,hdr,panorama");
		parm.set("sharpness-min","0");
		parm.set("face-detection-values","");
		parm.set("whitebalance","auto");
		parm.set("preview-format-values","yuv420sp,yuv420p,yuv420sp-adreno");
		parm.set("jpeg-thumbnail-quality","90");
		parm.set("preview-format","yuv420sp");
		parm.set("face-detection","off");
		parm.set("touch-index-af","-1x-1");
		parm.set("auto-exposure-values","frame-average,center-weighted,spot-metering");
		parm.set("video-zoom-support","true");
		parm.set("iso","ISO_HJR");
		parm.set("mce-values","enable,disable");
		parm.set("record-size","");
		parm.set("flash-mode-values","off,auto,on,torch");
		parm.set("preview-frame-rate","31");
		parm.set("jpeg-thumbnail-width","512");
		parm.set("scene-mode-values","auto,action,portrait,landscape,night,night-portrait,theatre,beach,snow,sunset,steadyphoto,fireworks,sports,party,candlelight,backlight,flowers,AR");
		parm.set("redeye-reduction","disable");
		parm.set("preview-fps-range-values","(1,200000)");
		parm.set("auto-exposure","center-weighted");
		parm.set("histogram","disable");
		parm.set("preview-size-values","1920x1088,1280x720,960x544,800x480,768x432,720x480,640x480,576x432,480x320,384x288,352x288,320x240,240x160,176x144");
		parm.set("touch-af-aec","touch-off");
		parm.set("preview-fps-range","1,200000");
		parm.set("auto-whitebalance-lock","false");
		parm.set("min-exposure-compensation","-12");
		parm.set("antibanding","off");
		parm.set("max-num-focus-areas","1");
		parm.set("vertical-view-angle","49.6");
		parm.set("video-stabilization-supported","true");
		parm.set("picture-format-values","jpeg,raw");
		parm.set("video-hfr","on");
		parm.set("exposure-compensation-step","0.166667");
		parm.set("scene-detect","on");
		parm.set("video-mode","0");
		parm.set("picture-size","2048x1536");
		parm.set("saturation","5");
		parm.set("whitebalance-values","auto,incandescent,fluorescent,daylight,cloudy-daylight");
		parm.set("picture-format","jpeg");
		parm.set("lensshade-values","enable,disable");
		parm.set("selectable-zone-af","auto");
		parm.set("video-hfr-values","off,60,90,120");
		parm.set("iso-values","auto,ISO_HJR,ISO100,ISO200,ISO400,ISO800,ISO1600");
		parm.set("selectable-zone-af-values","auto,spot-metering,center-weighted,frame-average");
		parm.set("lsc-calibration-check","success");
		parm.set("lensshade","enable");
		parm.set("slow-motion-res","768x432");
		parm.set("mce","enable");
		parm.set("hfr-size-values","800x480,640x480");
		parm.set("recording-hint","false");
		parm.set("flash-calibration-check","success");
		parm.set("video-stabilization","true");
		parm.set("zoom-supported","true");
		parm.set("strtextures","OFF");
		parm.set("denoise-values","denoise-off,denoise-on");
		parm.set("sharpness","10");
		parm.set("contrast","2");
		parm.set("scene-mode","auto");
		parm.set("jpeg-quality","100");
		parm.set("histogram-values","enable,disable");
		parm.set("overlay-format","265");
		parm.set("skinToneEnhancement","0");
		parm.set("preview-size","640x480");
		parm.set("focal-length","3.63");
		parm.set("denoise","denoise-off");
		parm.set("preview-frame-rate-values","5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31");
		parm.set("max-num-metering-areas","1");
		parm.set("focus-mode-values","auto,infinity,normal,macro,continuous-video,continuous-picture");
		parm.set("jpeg-thumbnail-size-values","512x288,480x288,432x288,512x384,352x288,0x0");
		parm.set("zoom-ratios","100,102,104,107,109,112,114,117,120,123,125,128,131,135,138,141,144,148,151,155,158,162,166,170,174,178,182,186,190,195,200,204,209,214,219,224,229,235,240,246,251,257,263,270,276,282,289,296,303,310,317,324,332,340,348,356,364,373,381,390");
		parm.set("picture-size-values","3264x2448,3264x1840,3264x1840,2992x1680,2592x1952,2592x1456,2048x1536,2048x1152,1920x1080,1600x1200,1600x912,1280x960,1280x768,1280x720,1024x768,800x600,800x480,640x480,640x368,352x288,320x240");
		parm.set("contrast-min","0");
		parm.set("touch-af-aec-values","touch-off,touch-on");
		parm.set("saturation-min","0");
		parm.set("contrast-max","10");
		parm.set("luma-adaptation","3");
		parm.set("horizontal-view-angle","63.4");
		parm.set("touch-index-aec","-1x-1");
		parm.set("slow-motion-x","4");
		parm.set("skinToneEnhancement-values","enable,disable");
		parm.set("jpeg-thumbnail-height","384");
		parm.set("focus-mode","continuous-video");
		parm.set("awb-calibration-check","success");
		parm.set("auto-whitebalance-lock-supported","true");
		parm.set("video-frame-format","yuv420sp");
		parm.set("max-num-detected-faces-sw","0");
		parm.set("saturation-max","10");
		parm.set("max-exposure-compensation","12");
		parm.set("video-snapshot-supported","false");
		parm.set("num-snaps-per-shutter","1");
		parm.set("exposure-compensation","12");
		parm.set("flash-mode","off");
		parm.set("auto-exposure-lock","false");
		parm.set("effect-values","none,mono,negative,solarize,sepia,posterize,whiteboard,blackboard,aqua,emboss,sketch,neon");
		parm.set("max-zoom","59");
		parm.set("effect","none");
		parm.set("focus-distances","0.78,1.57,Infinity");
		parm.set("touchAfAec-dx","100");
		parm.set("touchAfAec-dy","100");
		parm.set("auto-exposure-lock-supported","true");
		parm.set("antibanding-values","off,50hz,60hz,auto");
		
		return parm;
	}
}
